CWD DASHBOARD - IMPROVED SINGLE-FILE VERSION
==========================================

Main file: cwd_dashboard_improved.php

INSTALLATION
1. Keep a backup of your current dashboard file.
2. Upload cwd_dashboard_improved.php beside the current dashboard and open it
   through your PHP-enabled web server. It must not be opened as a local HTML file.
3. Check the dashboard totals against your database before replacing the old page.
4. To retain existing links, rename the tested file to the current dashboard's
   filename. No additional CSS, JavaScript, Composer packages, or database
   migrations are required.

CONNECTION
The connection settings from the uploaded PHP file have been retained. They can
be overridden with server environment variables:
CWD_DB_HOST, CWD_DB_NAME, CWD_DB_USER, CWD_DB_PASS, CWD_DB_CHARSET.

Requires PHP 8.0 or later and the PDO MySQL driver, as well as the existing
cwd_child, cwd_journal, and cwd_reevaluation tables and their existing fields.

ACCESS AND CONFIDENTIALITY
The original page did not specify an authentication or authorization model.
This redesign does not invent user roles or area-level permissions.

Place the page behind your application's existing login and permission checks.
An optional CWD_AUTH_SESSION_KEY environment variable enables a check for a
non-empty session value under that exact key. Use the key actually established
by your login. This optional check is not a replacement for your application's
role and row-level authorization. With no key configured, access behavior
remains unchanged from the original. Filter selections are NOT permissions.

The file retains a database password from the source. Treat it as confidential,
rotate that password, and preferably supply the replacement through the server
environment rather than embedding it in a shareable file.

The page performs read-only queries. Technical errors are logged to the server,
not displayed to visitors. The CSV export is an aggregate summary and does not
include child names or identifiers. Aggregate data can still be sensitive.

MAIN CHANGES
- Wide desktop dashboard with a collapsible mobile navigation menu.
- Six clickable indicators, outcome distribution, service-status chart,
  age/sex breakdown, health-area distribution, and follow-up links.
- Health area, facilitator, dossier status, follow-up focus, and search filters.
- A server-paginated child register with configurable page size and sorting.
- Information, journal, reassessment, and history views for each child.
- Server pagination for journal, reassessments, and combined history.
- Filtered CSV summary and print styling. No external assets or libraries.

COUNTING RULES
- Latest reassessment: most recent date_reevaluation, then highest id for ties.
  Only one reassessment contributes to each child's current status and outcome.
- Active: the latest decision is not the existing close/transfer decision.
  Children without a reassessment remain active, matching the source rule.
- No reassessment: active children who have no reassessment at all. This does
  not measure overdue reassessments or assume a required review interval.
- Journal counts represent events; distinct children served are also shown.
  Historical waiting/planned entries are not a proven current service backlog.
- Urgent flags come from the child's initial urgency field. They do not confirm
  that the urgency is still current.
- Missing/other sex and age values remain in denominators. Outcome charts
  include non-evaluable, missing, and unexpected outcome labels.
- Filters select children; their associated journal and reassessment records
  are then counted. There is no reporting-period filter in this version.

VALIDATION PERFORMED
PHP syntax validation passed using PHP 8.4.
Rendered pages and interactions were checked in Chromium using a separate
local SQL test adapter and fictional fixtures. Checks covered totals, tied
reassessment dates, closed cases, null fields, search escaping, profile tabs,
CSV output, empty data, pagination, and layouts from 320 to 1920 pixels wide.

The development environment does not have PDO MySQL installed and was not
connected to your live database. These checks are not a live MySQL deployment
test. Confirm the connection, field compatibility, access restrictions, and
performance on your server before replacing the existing page.

The supplied preview image is explicitly labeled as fictional test data.
No fixtures, sample records, or test database adapters are in the PHP deliverable.
